package ac.il.technion.c236369.hw4.core.entity;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;

import org.apache.http.entity.ContentProducer;

public abstract class SizedContentProducer implements ContentProducer {

	public long getContentLength( ) {
		ByteArrayOutputStream stream = new ByteArrayOutputStream( );
		try {
			writeTo(new PrintStream(stream));
		} catch (IOException e) {
		}
		return stream.size( );
	}
}
